<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="../include/tag.jsp"%>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>数据查看</title>
    <%@include file="../include/commonFile.jsp"%>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/common/table.css">

</head><body>
<%@include file="../include/header.jsp"%>

<div class="index-outside">
    <%@include file="../include/sidebar.jsp"%>
    <section>
        <div class="section-main">
            <%--联合发起--->众筹--%>
            <div class="layui-tab layui-tab-brief mt20">
                <ul class="layui-tab-title">
                    <c:choose>
                        <c:when test="${isMultiple == true}">
                            <li>众筹<span class="pl5">${activity.joinNum}</span>人</li>
                            <li class="layui-this">联合发起<span class="pl5">${activity.representNum}</span>人</li>
                        </c:when>
                        <c:otherwise>
                            <li class="" id="funding">众筹<span id="total_1" class="pl5">${activity.joinNum - directPayNum}</span>人</li>
                            <li class="layui-this" id="representing">联合发起<span id="total_0" class="pl5">${activity.representNum}</span>人</li>
                            <li class="" id="directPay">直接付款<span id="total_2" class="pl5">${directPayNum}</span>人</li>
                            <li class="" id="transfer">转入<span id="total_3" class="pl5">${transferNum}</span>人</li>
                        </c:otherwise>
                    </c:choose>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-tab-item  layui-show">
                        <form class="layui-form" action="${ctx}/crowdfund/project/listForDistributorId.do?relationId=${relationId}" id="myForm" method="post">
                            <input type="hidden" name="pageNo" id="pageNo" />
                            <input type="hidden" name="name"  value="${name}">
                        </form>
                        <form class="layui-form" action="${ctx}/crowdfund/project/listForDistributorIdExport.do?relationId=${relationId}" id="exportForm" method="post">
                            <input type="hidden" name="name"  value="${name}">
                        </form>
                        <div class="my-act-list-content">
                            <ul class="num">
                                <div class="l">
                                    <li class="f16">【${name} 联合发起】 的众筹人数<span class="red">${page.totalCount}</span>人</li>
                                </div>
                                <div class="r">
                                    <li style="cursor: pointer;" class="r">
                                        <a class="layui-btn layui-btn-danger layui-btn-sm" href="javascript:txz.expireCheck('', function() { exportExcelData() })">导出EXCEL</a>
                                    </li>
                                </div>
                                <p class="cl"></p>
                            </ul>
                            <div class="cl">
                                <table class="layui-table">
                                    <colgroup>
                                        <col width="8%">
                                        <col width="10%">
                                        <col width="8%">
                                        <col width="8%">
                                        <col width="8%">
                                        <col width="8%">
                                        <col width="8%">
                                        <col width="8%">
                                    </colgroup>
                                    <thead>
                                    <tr>
                                        <th>众筹者</th>
                                        <th>公司</th>
                                        <th>职务</th>
                                        <th>联系电话</th>
                                        <th>支持人数</th>
                                        <th>支持金额</th>
                                        <th>浏览量</th>
                                        <th>众筹状态</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <c:forEach var="directPay" items="${list}">
                                        <tr>
                                            <td class="table-member" onclick="openDialogShow('用户名片','${ctx}/system/member/memberView.do?id=${directPay.authorId}','400px','470px')">
                                                <div class="member-cell">
                                                <div class="member-logo common-img">
                                                    <img src="<c:if test="${directPay.authorLogo != null}">${directPay.authorLogo}?imageMogr2/auto-orient/crop/126x126</c:if>" alt="" onerror="txz.errImg(this)" onload="txz.imgLoad(this)">
                                                </div>
                                                <div class="member-name ellipsis-1"><a class="blue" title="${directPay.authorName}" href="javascript:void(0);" >${directPay.authorName}</a></div>
                                                </div>
                                            </td>
                                            <td>
                                                <div class="ellipsis-1" title="${directPay.authorCompany}">${directPay.authorCompany}</div>
                                            </td>
                                            <td>
                                                    ${directPay.authorJobTitle}
                                            </td>
                                            <td>
                                                    ${directPay.authorMobile}
                                            </td>
                                            <td>
                                                <a href="javascript:void(0);" class="blue ${directPay.actualAmount > 0 ? 'favorerNum' : ''} count-num" data-id="${directPay.id}" data-name="${directPay.authorName}">${directPay.favorerNum}</a>

                                            </td>
                                            <td>
                                                <a href="javascript:void(0);" class="blue ${directPay.actualAmount > 0 ? 'actualAmount' : ''} count-num" data-id="${directPay.id}" data-name="${directPay.authorName}"> ${directPay.actualAmount}</a>

                                            </td>
                                            <td>
                                                    ${directPay.viewNum}
                                            </td>
                                            <td>
                                                <c:if test="${directPay.isSuccess == 0}">
                                                    <span>众筹中</span>
                                                </c:if>
                                                <c:if test="${directPay.isSuccess == 1}">
                                                    <span>众筹成功</span>
                                                </c:if>
                                                <c:if test="${directPay.isSuccess == 2}">
                                                    <span>众筹失败</span>
                                                </c:if>
                                            </td>
                                        </tr>
                                    </c:forEach>
                                    </tbody>
                                </table>
                                <div id="page_content" class="page-container"></div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-tab-item">

                    </div>
                </div>
            </div>
        </div><%@include file="../include/footer.jsp"%>
    </section>
</div>

<script type="text/javascript" src="${ctx}/script/common/list.js"></script>
<script type="text/javascript">
    txz.initHeader({
        nav: [{
            name: '众筹项目',
            href: '${ctx}/activity/activity/zcActivityList.do'
        }, {
            name: '${activity.title}'
        }, {
            name: '数据查看',
            curr: true
        }],
        btns: [{
            type: 'back'
        }]
    });
    $(function () {

        //加载分页
        loadPageNew({
            elem: 'page_content',
            totalCount: '${page.totalCount}',
            limit: '${page.limit}',
            page: '${page.page}'
        });

        if (${isMultiple == true}) {
            $("#myForm").attr('action', '${ctx}/activityMultiple/project/activity/listForDistributor.do?id=${activity.id}&relationId=${relationId}');
        }

        layui.use(['element'], function () {
            var element = layui.element;
            element.on('tab', function (data) {
                if (${isMultiple == true}) {
                    if (data.index == 0) {
                        window.location.href = "${ctx}/activityMultiple/project/listForActivity.do?id=${activity.id}";
                    } else if (data.index == 1) {
                        window.location.href = "${ctx}/activityMultiple/represent/listForActivity.do?id=${activity.id}";
                    }
                } else {
                    if (data.index == 0) {
                        window.location.href = "${ctx}/activity/activity/zcCrowdfundList.do?id=${activity.id}";
                    } else if (data.index == 1) {
                        window.location.href = "${ctx}/activity/activity/zcRepresentList.do?id=${activity.id}";
                    } else if (data.index == 2) {
                        window.location.href = "${ctx}/activity/activity/zcDirectPayList.do?id=${activity.id}";
                    } else if (data.index == 3) {
                        window.location.href = "${ctx}/activity/activity/zcShiftToPeopleList.do?id=${activity.id}";
                    }
                }
            });
        });
        $('.favorerNum').click(function () {
            var projectId = this.dataset.id;
            if (${isMultiple == true}) {
                window.location.href = '${ctx}/activityMultiple/support/activity/listForRepresent.do?id=${activity.id}&projectId=' + projectId;
            } else {
                window.location.href = '${ctx}/crowdfund/support/listForRepresent.do?id=${activity.id}&projectId=' + projectId;
            }
        });

        $('.actualAmount').click(function () {
            var projectId = this.dataset.id;
            if (${isMultiple == true}) {
                window.location.href = '${ctx}/activityMultiple/support/activity/listForRepresent.do?id=${activity.id}&projectId=' + projectId;
            } else {
                window.location.href = '${ctx}/crowdfund/support/listForRepresent.do?id=${activity.id}&projectId=' + projectId;
            }
        });
    })

    function exportExcelData() {
        layer.confirm('确认要导出Excel吗?', {
            icon: 3,
            title: '系统提示'
        }, function (index) {
            //loading层
            var loadIndex = layer.load(1, {
                shade: [0.1, '#fff'] //0.1透明度的白色背景
            });
            var url = $("#exportForm").attr("action");
            $.post(url, $("#exportForm").serialize(), function (res) {
                top.layer.close(loadIndex);
                if (res.success) {
                    window.location.href = res.data;
                } else {
                    util.layerMsgError(res.description)
                }
            });
            top.layer.close(index);
        });
    }
</script>
</body>
</html>
